package ws.performancetest.tests.jdbcdriver;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import ws.jdbc.concurrent.driver.sqlserver.CDriver;
import ws.jdbc.concurrent.driver.sqlserver.benchmark.Benchmark;
import ws.performancetest.api.AbstractTestSuite;
import ws.performancetest.api.annotation.PerformanceTest;
import ws.performancetest.api.exception.TestSuiteSetupException;

/**
 *
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
public class BenchmarkPoints extends AbstractTestSuite {

  String url;

  public BenchmarkPoints() throws TestSuiteSetupException {
    super("BenchmarkPoints_Results", "BenchmarkPoints_Summary");
  }

  @PerformanceTest(name = "getInt")
  public void testGetInt() throws SQLException {
    CDriver driver = new CDriver();
    Benchmark.setTestSuite(this);
    Connection tcon = driver.connect(url, null);
    Statement stmt = tcon.createStatement();
    ResultSet rs = stmt.executeQuery("select * from table1");

    for (int i = 0; i < cycleCount; ++i) {
      rs.next();
      rs.getInt(1);
    }
  }
}
